{% extends "templates/base.phtml" %}
{%block content%}
<div class="page-content-wrap">
    <div class="row">
        <div class="col-md-12 form-horizontal">
            <div class="form-horizontal" role="form">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form method="post">
                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">活动名称：</label>

                                <div class="col-md-6 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                        <input name="name" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">活动详情：</label>

                                <div class="col-md-6 col-xs-12">
                                    <textarea class="form-control" name="info" placeholder="活动详情..."></textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">活动图片：</label>

                                <div class="col-md-6 col-xs-12">
                                    <input class="J-fileup" id="fileup" name="fileup"
                                           type="file" multiple="true">
                                    <input id="pic" name="pic" class="form-control"
                                           type="hidden" value="">
                                    <img id="thumb" src="" style="max-height: 200px;max-width: 200px">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-3 col-xs-12 control-label">有效期时间：</label>
                                <div class="col-xs-3">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
                                        <input name="start" type="text" class="form-control datepicker" placeholder="起始时间">
                                    </div>
                                </div>
                                <div class="col-xs-3">
                                    <div class="input-group">
                                        <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
                                        <input name="end" type="text" class="form-control datepicker" placeholder="截止时间">
                                    </div>
                                </div>
                            </div>


                            <div class="form-group col-md-12">
                                <div class="col-md-6 col-xs-12 col-md-offset-4">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-danger" type="reset">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{%endblock%}
{%block end%}
<style type="text/css">
    table * {
        text-align: center;
    }
</style>
<script src="/assets/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/assets/uploadify/uploadify.css">
<script type="text/javascript">


    $(function () {
        $(".J-fileup").each(function () {
            $(this).uploadify({
                'formData': {},
                'swf': '/assets/uploadify/uploadify.swf',
                'uploader': '/admin/resource/upload',
                'cancelImg': '/assets/uploadify/uploadify-cancel.png',//单个取消上传的图片
                'onUploadSuccess': function (file, data, response) {
                    var data = JSON.parse(data);
                    if (data.status == 1) {
                        $('#pic').val(data.data);
                        $('#thumb').attr("src", data.data);
                        $('#thumb').css("display", "block");
                    }

                }
            });
        });
    });


</script>

{%endblock%}